*Analysis of 2020 Lusaka study, survey data
*Data received Aug 25 2020
**Using data set merged by Radhika Nagesh

clear 
use "vars_merged_RN_IPA.dta"

egen session_id_rev = group (wsdate_list selfsacrificetreatment_list)


gen pol_veryinterested_endline=0
replace pol_veryinterested_endline=1 if polinterest_endline==4

gen selfefficacytreatment_worked=0
replace selfefficacytreatment_worked=1 if selfefficacytreatment_list==1 & trt_updated==1
gen selfsacrificetreatment_worked=0
replace selfsacrificetreatment_worked=1 if selfsacrificetreatment_list==1 & trt_updated==1
gen control=0
replace control=1 if trt_updated==0

gen streetrecruitment=.
replace streetrecruitment=0 if recruit==2
replace streetrecruitment=1 if recruit==1

gen female=1 if participant_gender==2
replace female=0 if participant_gender==1


** Table 1
reg protest_endline selfefficacytreatment_list protest_baseline, cluster(session_id_rev)
reg vote_endline selfefficacytreatment_list vote_baseline, cluster(session_id_rev)
reg contactgovt_endline selfefficacytreatment_list contactgovt_baseline, cluster(session_id_rev)
reg pol_veryinterested_endline selfefficacytreatment_list pol_veryinterested, cluster(session_id_rev)
reg donated selfefficacytreatment_list, cluster(session_id_rev)

*Table 2
reg protest_endline selfefficacytreatment_list##female protest_baseline, cluster(session_id_rev)
reg vote_endline selfefficacytreatment_list##female vote_baseline, cluster(session_id_rev)
reg contactgovt_endline selfefficacytreatment_list##female contactgovt_baseline, cluster(session_id_rev)
reg pol_veryinterested_endline selfefficacytreatment_list##female pol_veryinterested, cluster(session_id_rev)
reg donated selfefficacytreatment_list##female, cluster(session_id_rev)

**Table 3
reg badchristian selfefficacytreatment_list, cluster(session_id_rev)
reg badcitizen selfefficacytreatment_list, cluster(session_id_rev)
reg totallyunjustified selfefficacytreatment_list, cluster(session_id_rev)

**Table 4
reg violenceneverjustified selfefficacytreatment_list, cluster(session_id_rev)
reg violencesometimesnecessary selfefficacytreatment_list, cluster(session_id_rev)
reg violentprotest_endline selfefficacytreatment_list, cluster(session_id)

**Table 5 -- with control condition 
**with unbalanced controls
reg protest_endline selfefficacytreatment_worked selfsacrificetreatment_worked protest_baseline ucz catholic english bemba, cluster(session_id_rev)
reg violenceneverjustified selfefficacytreatment_worked selfsacrificetreatment_worked ucz catholic english bemba, cluster(session_id_rev)
reg violentprotest_endline selfefficacytreatment_worked selfsacrificetreatment_worked ucz catholic english bemba, cluster(session_id_rev)
reg badcitizen selfefficacytreatment_worked selfsacrificetreatment_worked ucz catholic english bemba, cluster(session_id_rev)

* Table 6 -- among non-pentecostals and non-bornagains, with controls 
reg protest_endline selfefficacytreatment_worked selfsacrificetreatment_worked protest_baseline english bemba if pentecostal_selfid==0, cluster(session_id_rev)
reg protest_endline selfefficacytreatment_worked selfsacrificetreatment_worked protest_baseline english bemba if bornagain_selfid==0, cluster(session_id_rev)
reg violenceneverjustified selfefficacytreatment_worked selfsacrificetreatment_worked english bemba if pentecostal_selfid==0, cluster(session_id_rev)
reg violenceneverjustified selfefficacytreatment_worked selfsacrificetreatment_worked english bemba if bornagain_selfid==0, cluster(session_id_rev)


****In the appendix

*Table C.1
sum female english nyanja bemba age married numchildren noschooling primaryschool highschool university gradschool ucz catholic pentecostal otherchurch bornagain pentecostal_selfid attenddaily attendtwiceaweek attendonceaweek church_leader polinterest_endline bauleni chawama mtendere streetrecruitment

*** balance tests

*Table C.2
ttest female, by(selfefficacytreatment_list) unequal 
ttest english, by(selfefficacytreatment_list) unequal 
ttest nyanja, by(selfefficacytreatment_list) unequal 
ttest bemba, by(selfefficacytreatment_list) unequal 
ttest age, by(selfefficacytreatment_list) unequal 
ttest married, by(selfefficacytreatment_list) unequal 
ttest numchildren, by(selfefficacytreatment_list) unequal 
ttest educationlevel, by(selfefficacytreatment_list) unequal 
ttest ucz, by(selfefficacytreatment_list) unequal 
ttest catholic, by(selfefficacytreatment_list) unequal 
ttest pentecostal, by(selfefficacytreatment_list) unequal 
ttest attendonceaweek, by(selfefficacytreatment_list) unequal 
ttest church_leader, by(selfefficacytreatment_list) unequal 
ttest pol_veryinterested, by(selfefficacytreatment_list) unequal 
ttest protest_baseline, by(selfefficacytreatment_list) unequal 
ttest streetrecruitment, by(selfefficacytreatment_list) unequal

*Table C.3
ttest female if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest english if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest nyanja if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest bemba if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest age if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest married if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest numchildren if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest educationlevel if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest ucz if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest catholic if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest pentecostal if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal  
ttest attendonceaweek if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal  
ttest church_leader if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest pol_veryinterested if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest protest_baseline if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal 
ttest streetrecruitment if control==1 | selfefficacytreatment_worked==1, by(selfefficacytreatment_worked) unequal

ttest female if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 
ttest english if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 
ttest nyanja if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal  
ttest bemba if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 
ttest age if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal  
ttest married if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 
ttest numchildren if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 
ttest educationlevel if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 
ttest ucz if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 
ttest catholic if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 
ttest pentecostal if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal  
ttest attendonceaweek if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal   
ttest church_leader if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal  
ttest pol_veryinterested if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 
ttest protest_baseline if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 
ttest streetrecruitment if control==1 | selfsacrificetreatment_worked==1, by(selfsacrificetreatment_worked) unequal 

**Figure C.1 
gen attendtwoormore=0
replace attendtwoormore=1 if attendtwiceaweek==1 | attenddaily==1
ttest pol_veryinterested, by(female_list) unequal
ttest vote_baseline, by(female_list) unequal
ttest contactgovt_baseline, by(female_list) unequal
ttest church_leader, by(female_list) unequal
ttest attendtwoormore, by(female_list) unequal


** Figure C.2 dropping one session at a time
**without session 16
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=16, cluster(session_id_rev)
**without session 15
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=15, cluster(session_id_rev)
**without session 14
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=14, cluster(session_id_rev)
**without session 13
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=13, cluster(session_id_rev)
**without session 12
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=12, cluster(session_id_rev)
**without session 11
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=11, cluster(session_id_rev)
**without session 10
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=10, cluster(session_id_rev)
**without session 09
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=9, cluster(session_id_rev)
**without session 08
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=8, cluster(session_id_rev)
**without session 07
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=7, cluster(session_id_rev)
**without session 06
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=6, cluster(session_id_rev)
**without session 05
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=5, cluster(session_id_rev)
**without session 04
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=4, cluster(session_id_rev)
**without session 03
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=3, cluster(session_id_rev)
**without session 02
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=2, cluster(session_id_rev)
**without session 01
reg protest_endline selfefficacytreatment_list protest_baseline if session_id_rev~=1, cluster(session_id_rev)

**Table C.5

reg badchristian selfefficacytreatment_list##female, cluster(session_id_rev)
reg badcitizen selfefficacytreatment_list##female, cluster(session_id_rev)
reg totallyunjustified selfefficacytreatment_list##female, cluster(session_id_rev)
reg violentprotest_endline selfefficacytreatment_list##female, cluster(session_id_rev)
reg violenceneverjustified selfefficacytreatment_list##female, cluster(session_id_rev)
reg violencesometimesnecessary selfefficacytreatment_list##female, cluster(session_id_rev)


** Table C.6 Catholics only
reg protest_endline selfefficacytreatment_list protest_baseline if catholic==1, cluster(session_id_rev)
reg vote_endline selfefficacytreatment_list vote_baseline if catholic==1, cluster(session_id_rev)
reg pol_veryinterested_endline selfefficacytreatment_list pol_veryinterested if catholic==1, cluster(session_id_rev)
reg violentprotest_endline selfefficacytreatment_list if catholic==1, cluster(session_id_rev)
reg violencesometimesnecessary selfefficacytreatment_list if catholic==1, cluster(session_id_rev)

*Table C.7 optimism about democracy
reg dem_quality_better_bin selfefficacytreatment_worked selfsacrificetreatment_worked ucz catholic english bemba, cluster(session_id_rev)

*Table C.8 by method of recruitment, with controls
reg protest_endline selfefficacytreatment_worked##streetrecruitment selfsacrificetreatment_worked##streetrecruitment protest_baseline ucz catholic english bemba, cluster(session_id_rev)
reg pol_veryinterested_endline selfefficacytreatment_worked##streetrecruitment selfsacrificetreatment_worked##streetrecruitment pol_veryinterested ucz catholic english bemba, cluster(session_id_rev)
reg badcitizen selfefficacytreatment_worked##streetrecruitment selfsacrificetreatment_worked##streetrecruitment ucz catholic english bemba, cluster(session_id_rev)

*Table C.9 by marital and parental status
sum numchildren
gen haschildren=0 if numchildren==0
replace haschildren=1 if numchildren>0 & numchildren~=.

reg badcitizen selfefficacytreatment_list##married, cluster(session_id_rev)
reg badcitizen selfefficacytreatment_worked##married selfsacrificetreatment_worked##married, cluster(session_id_rev)
reg badcitizen selfefficacytreatment_list##haschildren, cluster(session_id_rev)
reg badcitizen selfefficacytreatment_worked##haschildren selfsacrificetreatment_worked##haschildren, cluster(session_id_rev)

**Table C.4 Diff in diff set up
expand 2, gen(dupindicator)
*column 1
gen protestparticipdid=protest_baseline if dupindicator==0
replace protestparticipdid=protest_endline if dupindicator==1
rename dupindicator endlinemeasurement 
reg protestparticipdid endlinemeasurement##selfefficacytreatment_list, cluster(session_id_rev)

*column 2
gen votedid=vote_baseline if endlinemeasurement==0
replace votedid=vote_endline if endlinemeasurement==1
reg votedid endlinemeasurement##selfefficacytreatment_list, cluster(session_id_rev)

*column 3
gen polinterestdid=pol_veryinterested if endlinemeasurement==0
replace polinterestdid=pol_veryinterested_endline if endlinemeasurement==1
reg polinterestdid endlinemeasurement##selfefficacytreatment_list, cluster(session_id_rev)

*column 4
gen contactgovtdid=contactgovt_baseline if endlinemeasurement==0
replace contactgovtdid=contactgovt_endline if endlinemeasurement==1
reg contactgovtdid endlinemeasurement##selfefficacytreatment_list, cluster(session_id_rev)



